#include <iostream>
using namespace std;

template<class T>
struct ListNode
{
	T _val;
	ListNode<T>* _next;
	ListNode<T>* _prev;

	ListNode(const T& val = T())
		:_val(val)
		, _next(nullptr)
		, _prev(nullptr)
	{}
};

template<class T, class Ref, class Ptr>
struct ListIterator
{
	typedef ListNode<T> Node;
	typedef ListIterator<T, Ref, Ptr> Self;

	Node* _ptr;

	ListIterator(Node* node)
		:_ptr(node)
	{}

	Ref operator*()
	{
		return _ptr->_val;
	}

	Ref operator->()
	{
		return &(_ptr->_val);
	}

	Self& operator++()
	{
		_ptr = _ptr->_next;
		return *this;
	}

	Self& operator--()
	{
		_ptr = _ptr->_prev;
		return *this;
	}

	Self operator++(int)
	{
		Self tmp(_ptr);
		_ptr = _ptr->_next;
		return tmp;
	}

	Self operator--(int)
	{
		Self tmp(_ptr);
		_ptr = _ptr->_prev;
		return tmp;
	}

	bool operator!=(const Self& it)
	{
		return _ptr != it._ptr;
	}
};

int main()
{

	return 0;
}